<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<!--{include file='comm/header.tpl'}-->
	<title>发布管理</title>
</head>
<body>
<div style="width:100%">
	
	<div id="body_content"  class="items2">
		<div id="userLogin" style="width:975px;height:300px;margin:0 auto;padding:100px;">
		<form id="loginForm" onsubmit="return false;" method="POST">
			<table id="loginTable">
				<tr>
					<td width="400" class="tar">用户名：</td>
					<td width="*" class="td_input"><input type="text" name="username" id="username" value="<!--{$user_1}-->" ><span id="userHint"><font color="red"></font></span></td>
				</tr>
				<tr>
					<td class="tar">密码：</td>
					<td class="td_input"><input type="password" name="pwd" id="pwd" value="<!--{$pwd_1}-->" ><span id="pwdHint"><font color="red"><!--{$error_msg_1}--></font></span></td>
				</tr>
				<tr>
					<td colspan="2" style="text-align:center;">
						 <input class="btn" type="button" onclick="loginCheck();" value="登录" class="searchBtn searched" name="searchBtn" id="searchBtn">　
						 <input class="btn" type="button" onclick="history.go(-1);" value="返回" name="canclBtn" class="saveCancelBtn">
					</td>
				</tr>
			</table>
		</form>
		</div>
	</div>
	
	<!--{include file='comm/footer.tpl'}-->
	
</div>
<script type="text/javascript">
/*---------------------------检查用户登录-----------------------*/
$(function(){
	//检查username是否为空
	$('#username').blur(function(){
		var pwd = $('#pwd').val();
		var username = $('#username').val();
		if (username == "") {
			$('#userHint').html('<font color=red>用户名不能为空！</font>');
		} else if(username != ""){
			$('#userHint').html('');
		}
	});
	//ajax检查pwd是否正确
	$('#pwd').blur(function(){
		var pwd = $('#pwd').val();
		var username = $('#username').val();
		if (pwd == "") {
			$('#pwdHint').html('<font color=red>密码不能为空！</font>');
		} else {
			$('#pwdHint').html('');
			var dt = $('#loginForm').serializeArray();
			$.ajax({
                    type: "POST",
                    url: "/invokingAjax-backend/project/issueInfo.ajax?operFlg=3",
                    dataType: "JSON",
                    data: dt,
                    success: function( result_obj ) {
                        if (result_obj.code == 200) {
							display_right_hint();
                        } else {
                            display_error_hint(result_obj.message);
                        }
                    }
                });
		}
	});
});
function display_error_userHint(hint){
	$('#userHint').html(hint);
}
function display_right_hint(){
	$('#pwdHint').html('');
}
function display_error_hint(error){
	$('#pwdHint').html('<font color=red>'+error+'</font>');
}
function loginCheck(){
	var userHint = $('#userHint').html();
	var pwdHint = $('#pwdHint').html();

	var username = $('#username').val();
	var pwd = $('#pwd').val();
	if (username == "" || pwd == "") {
		if (pwd == "") {
			$('#pwdHint').html('<font color=red>密码不能为空！</font>');
		}
		if (username == "") {
			$('#userHint').html('<font color=red>用户名不能为空！</font>');
		}
	} else {
		var loginForm = document.getElementById("loginForm");
		loginForm.action = "/quanliadmin/app/project/issueInfo.pscript?operFlg=3&return_url=<!--{$return_url}-->";
		loginForm.submit();
	}
}
</script>
</body>
</html>